#ifndef _I2C_CTRL_H
#define _I2C_CTRL_H

typedef struct i2c_msg{
    unsigned int addr;
    int flags;//1:read; 0:write;
    int cnt_transfered;
    int err;
    unsigned char* buf;
    int len;
}i2c_msg_t,*i2c_msg_p;

typedef struct i2c_controller{
    int (*init)(void);
    int (*master_xfer)(i2c_msg_p msgs,int num);
    char *name;
}i2c_ctrl_t,*i2c_ctrl_p;

int register_i2c_ctl(i2c_ctrl_p *p);

int select_i2c_ctl(char* name);
	    
int i2c_transfer(i2c_msg_p msgs,int num);

void init_i2c_ctl(void);


#endif /* ifndef _I2C_CTRL_H */
